'use strict';let _ji={tse:{editor:_dy(),newName:"My custom tab selection",newValue:[],genericName:"tab selection"},gridLayout:{editor:_sa,newName:"My grid",newValue:{},genericName:"grid layout"},menuSpec:{editor:_Nj(),newName:"My custom menu",newValue:{type:"custom",content:[]},genericName:"menu"},menuStyle:{editor:_Qu,newName:"My menu style",newValue:{},genericName:"menu style"},binSwtch:{editor:_Qu,newName:"My switch",newValue:{},genericName:"switch"},script:{genericName:"script"}};const _0a="Other...";
let _kp={1:"Favorite list One",2:"Favorite list Duo",3:"Favorite list Terna",4:"Favorite list Quater",5:"Favorite list Penta",6:"Favorite list Hex",7:"Favorite list 7",8:"Favorite list Octave",9:"Favorite list Nona",10:"Favorite list X"};function _wd(a){let b=0;for(;++b in(_hf._Ot[a]||{}););return a+":"+b}function _cy(a,b){return(c=_Qu)=>{let e=_wd(a),d={name:"binSwtch"==a?`${_ji[a].newName} ${Object.keys(_hf._Ot[a]||[]).length+1}`:"",value:b||_9g(_ji[a].newValue)};_we(e,d,0,()=>c(e))}}
function _hg(a,b){_wl(a,c=>{c?_yt(`This item is being used in <r>${c}</r> other places. <br> It cannot be deleted.`):_1h(a,b)})}function _1h(a,b){let c=_Uk(a)[0];if("script"==c){let e=_Kg(_er(a),"value","srcFile");e&&_hf._9y(e)(d=>{_7s(d,void 0)});_c(a)()}_we(a,void 0,0,()=>{"menuSpec"==c&&_dj(0);b&&b()})}
function _Wf(a){_tl({trigActList:null,customEntities:{},mouseGest:{}},b=>{const c=JSON.stringify([b.trigActList,b.customEntities.tse,b.customEntities.menuSpec,b.mouseGest.triggers]);a(e=>(c.match(new RegExp('"'+e+'"',"g"))||[]).length)})}function _wl(a,b){_Wf(c=>b(c(a)))}
let _1i=(...a)=>_Va(a,!0),_Va=_wj(function*(a=[],b){do{var c=!1;let e=yield f=>_Wf(f),d=new _do;a.length||(a=Object.keys(_hf._Ot));for(let f of a)for(let [g,h]of _hf._Ot[f]||[])if(!b||!h.name||!h.value||"binSwtch"==f){const k=f+":"+g;0==e(k)&&(_1h(k,d.onReady()),!c&&f.in("tse","menuSpec")&&(c=!0))}yield f=>d.setCallback(f)}while(c)});function _rg(a){return!!$(a).find("[entityType=binSwtch][value^=b]")[0]}function _dj(a=0){setTimeout(()=>_1i("binSwtch")(),a)}
function _Pw(a=0){setTimeout(()=>_1i("menuSpec")(),a)}let _Ze=_wj(function*(a,b){var c=_Uk(a)[0];let e=_ji[c].genericName;if(b)for(let d of _Ws(c)){if(c=_er(d).name,d!=a&&!_bo(b,c))return _yt(`There's already a ${e} called <b>${c}</b>. <br> Please enter a different name.`,{type:"warning"}),[!1]}else if((b=_er(a).name)&&1<(yield d=>_wl(a,d)))return _yt(`This ${e} is being used in more than one place. <br> Its name cannot be blank.`,{type:"warning"}),[!1,b];return[!0]});
function _ns(a){var b=_Uk(a)[0];let c=_9g(_er(a,b)),e=_ji[b].genericName,d=$(`\n <namedEntityEditor DataModule>\n <div>\n <input type=text spellcheck=false maxlength=80 placeholder="Give a name to this ${e} (optional)" title="Click to change name">\n <h h=/entName ent="${e}"></h>\n </div>\n </namedEntityEditor>\n `).prop("value",c.value).on("change",function(){_we([a,"value"],this.value,100,()=>{$(`[value='${a}']`).triggerEvt("redefine",!0)})}).on("close",function(){$(this.children).triggerEvt("close")}).find("input").val(c.name).on("input",
_Ow(250,_Et(function*(){let f=this.value.trim(),[g,h]=yield _Ze(a,f);h&&(this.value=h);if(!g)return!1;_we([a,"name"],f);$(`[value='${a}'] > l`).text(f||_0a);$(this).closest("floatbox").triggerEvt("resize")}))).change(!1).end();d.updateEmptyState=function(){this.toggleClass("empty",$("> .empty",this)[0])};b=_ji[b].editor(d[0]).on("change",()=>d.updateEmptyState());d.append(b).prop("onInitDone",b[0].onInitDone).updateEmptyState();return d}
function _iw(a,b){return _Jh(a,b,"brlt RR,HR","tailAndShadowBlurry","auto-detect","transformAndOpacitySlow")}function _Ee(a,b){return _wt("binSwtch",a,b,"",!1,!0,!1,"",!1)}
function _wt(a,b,c,e,d=!1,f=!0,g=!0,h="",k=!0){let l=_er(c,a);e=e||`Choose a ${_ji[a].genericName}...`;d&&"boolean"==typeof d&&(d="(blank)");return`<customSelect entityType=${a} name="${b}" value="${c||""}" ${f?"newOpt":""} ${d?`emptyOpt="${d}"`:""} ${g?"editBtn":""} ${k?"":"noDelBtn"} optionsFilter="${h}" placeholder="${e}">${_xp(c)?`<l>${l.name||_0a}</l>`+(g?" <edit></edit>":""):l.name||""}</customSelect>`}
function _Cg(a,b,c){let e=b instanceof HTMLElement,d=e?$(b).attr("value"):b,f="binSwtch"==$(a).attr("entityType");c=(f?"":c)||(e?$("l",b).text()||$(b).text():_er(d,$(a).attr("entityType")).name||"");let g=$(a).attr("value");if(_xp(g)){let h=_er(g);h.name&&!f||_wl(g,k=>{1>=k?(_1h(g),a.prevAnonEntity=h.value):f||(a.prevAnonEntity=g)})}$(a).attr("value",d).html(_xp(d)?`<l>${c}</l>`+($(a).is("[editBtn]")?"<edit></edit>":""):`${c}`).triggerEvt("change",!0)}
function _yj(a,b,c,e){let d=_er(b,a),f=_xp(b);return`<item value="${b}" ${f?"custom":""} ${d.perms?`perms="${d.perms}"`:""} ${b==c?"selected":""}>\n <l>${d.name}</l> ${d.help?`<h h="/${a}/${d.help}"></h>`:""} ${f&&!e?'<del button title="Delete"></del>':""}\n </item>`}
function _k(a){var b=$(a).attr("value");let c=$(a).attr("entityType"),e=$(a).attr("emptyOpt"),d=$(a).attr("optionsFilter"),f=$(a).is("[newOpt]"),g=$(a).is("[noDelBtn]"),h="",k="";for(let [l,m]of _hf._2i[c])if(!d||d in m)h+=_yj(c,l,b,g);for(let l of _Ws(c,!0))k+=_yj(c,l,b,g);b=$(`\n <namedEntityMenu DataModule>\n ${e?`<item value="" label="${e}"></item>`:""}\n ${h}\n ${h&&k?"<hr>":""}\n ${k}\n ${f?`\n <hr>\n <newEntity type=${c}>New ${_ji[c].genericName}...</newEntity>\n `:""}\n </namedEntityMenu>\n `);
return _1r(b,a)}function _bg(...a){return _wt(...a)}
function _1r(a,b){return $(a).on("click","item",function(){$(this).triggerEvt("focusLost",!0);_Cg(b,this)}).on("click","newEntity",_Et(function*(){var c=$(b).attr("value");if(!_xp(c)||_er(c).name)c=b.prevAnonEntity,c="string"==typeof c?c:yield _cy($(this).attr("type"),c),_Cg(b,c,_0a);$(this).triggerEvt("focusLost",!0);setTimeout(()=>$("edit",b).triggerEvt("mousedown"),200)})).on("click","del",function(c){c.stopImmediatePropagation()}).on("dblclick","del",function(c){c=$(this).closest("item").attr("value");
_hg(c,()=>$(this).closest("item").remove())})}function _4u(a,b){let c={};for(let e of a)a=_er(e,b),c[e]=[a.name,a.help?"/"+b+"/"+a.help:""];return c};
